#include "Mouse.h"

namespace input {

	Mouse::Mouse() :
		m_position( cmn::Vec2::Zero() ),
		m_wheelPosition( 0 )
	{
		m_buttons = new ButtonState[3];
		m_buttons[int( MouseButton::Left )] = ButtonState::Released;
		m_buttons[int( MouseButton::Middle )] = ButtonState::Released;
		m_buttons[int( MouseButton::Right )] = ButtonState::Released;
	}

	Mouse::Mouse( const Mouse& mouse ) :
		m_position( mouse.m_position ),
		m_wheelPosition( mouse.m_wheelPosition )
	{
		m_buttons = new ButtonState[3];
		m_buttons[int( MouseButton::Left )] = mouse.m_buttons[int( MouseButton::Left )];
		m_buttons[int( MouseButton::Middle )] = mouse.m_buttons[int( MouseButton::Middle )];
		m_buttons[int( MouseButton::Right )] = mouse.m_buttons[int( MouseButton::Right )];
	}

	Mouse::~Mouse() {
		delete[] m_buttons;
	}

	Mouse& Mouse::operator=( const Mouse& other ) {
		if( this == &other ) return *this;

		m_buttons[int( MouseButton::Left )] = other.m_buttons[int( MouseButton::Left )];
		m_buttons[int( MouseButton::Middle )] = other.m_buttons[int( MouseButton::Middle )];
		m_buttons[int( MouseButton::Right )] = other.m_buttons[int( MouseButton::Right )];

		return *this;
	}
}
